// BinaryHeap.h: interface for the CBinaryHeap class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_BINARYHEAP_H__2033E195_85E5_4F4D_86E7_880CDF4A2CE9__INCLUDED_)
#define AFX_BINARYHEAP_H__2033E195_85E5_4F4D_86E7_880CDF4A2CE9__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <stdio.h>
#include <string.h> 

class CBinaryHeap  
{
public:
	CBinaryHeap();
	virtual ~CBinaryHeap();
	NODE& BHGetTop();
	int BHGetNum();
	bool BHAdjustByIndex(int index, int nNewValue);
	bool BHDelTop();
	bool BHAddNew(int x, int y, int value);
	void BHReset();
	
private:
	int		count ;
	PNODE	pHeap ;
	void BHUpdatePos(int x, int y, int pos);
	int BHFilterUp(int index);
	int BHFilterDown(int index);
};

#endif // !defined(AFX_BINARYHEAP_H__2033E195_85E5_4F4D_86E7_880CDF4A2CE9__INCLUDED_)
